package com.mowh.gof23.behavioral.patterns.visitor;

/**
 * @author mowh1gd
 * @create 2023/10/20 10:16
 */
public class Main {
    public static void main(String[] args) {
        System.out.println("Making root entries...");
        Directory rootDir = new Directory("root");
        Directory binDir = new Directory("bin");
        Directory tmpDir = new Directory("tmp");
        Directory usrDir = new Directory("usr");
        rootDir.add(binDir);
        rootDir.add(tmpDir);
        rootDir.add(usrDir);
        binDir.add(new File("vi", 10000));
        binDir.add(new File("latex", 20000));
        rootDir.accept(new ListVisitor());

        System.out.println("");
        System.out.println("Making user entries...");
        Directory david = new Directory("David");
        Directory john = new Directory("John");
        Directory elis = new Directory("Elis");
        usrDir.add(david);
        usrDir.add(john);
        usrDir.add(elis);
        david.add(new File("diary.html", 100));
        david.add(new File("Composite.java", 200));
        john.add(new File("memo.txt", 300));
        elis.add(new File("game.doc", 400));
        elis.add(new File("junk.mail", 500));
        rootDir.accept(new ListVisitor());
    }
}
